/**
 * 
 */
package com.antilia.infomaresme.pages.myitems;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.IModel;

import com.antilia.infomaresme.InfomaresmeSession;
import com.antilia.infomaresme.pages.alert.AlertsPage;
import com.antilia.infomaresme.pages.home.PrivateSearchPage;
import com.antilia.infomaresme.pages.messages.ListMessagesPage;
import com.antilia.infomaresme.provider.UserLdm;

/**
 * @author Ernesto
 *
 */
public class TitlePanel extends Panel {

	private static final long serialVersionUID = 1L;

	/**
	 * @param id
	 */
	public TitlePanel(String id, IModel<String> title) {
		super(id);
		add(new Label("title", title));

		 
		AjaxLink<Void> busquedas = new AjaxLink<Void>("busquedas") {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				setResponsePage(PrivateSearchPage.class);
			}
		};		
		add(busquedas);
		
		AjaxLink<Void> alertas = new AjaxLink<Void>("alertas") {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				setResponsePage(new AlertsPage(new UserLdm(InfomaresmeSession.getSession().getUserId())));
			}
		};		
		add(alertas);
		
		AjaxLink<Void> mensajes = new AjaxLink<Void>("mensajes") {
			
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick(AjaxRequestTarget target) {
				setResponsePage(new ListMessagesPage());
			}
		};		
		add(mensajes);
		
	}
}
